public class Runnian {
    public static void main(String[] args) {
        for (int i = 1000; i <= 2000; i++) {
            if(runNian(i)){
                System.out.print(i+" ");
            }
        }
    }

    public static boolean runNian(int year){
        if ((year % 400 == 0)||(year % 4 == 0&&year % 100 != 0)){
            return true;
        }
        return false;
    }
}
